{% extends "base.html" %}
{% block content %}
<div class="main">
	<div class="row">
		<div class="col-md-12">
			<div class="text-wrap">
				本地cms识别，利用本地md5值进行爆破比对
			</div>
		</div>
	</div>
	<div class="row">
		<div class="col-lg-12">
            <form method="post" action="/whatcms" id="inputform">
			<div class="input-group input-group-lg">
				<input type="text" id="url" class="form-control" aria-label="..." name="url">
				<div class="input-group-btn">
					<button type="button" id="getwebdna" class="btn btn-info btn-lg search-btn" aria-haspopup="true" aria-expanded="false"><b>识别</b></button>
				</div>
			</div></form>
		</div>
    </div>
    <div class="row main-panel output">
        <div class="col-md-1"></div>
			<div class="col-md-10">
				<div id="color" class="panel panel-primary">
					<div class="panel-heading" id="result">
						结果：
					</div>
                    <table class="table table-hover" >
                        <thead>
                            <tr>
                                <th>contents:</th>
                            </tr>
                        </thead>
                    <tbody id="t_body">
                    <!--output-->
                    </tbody>
                    </table>
                </div>
            </div>
    </div>
    <div class="row">
		<div class="col-md-10">
			<div class="text-wrap">
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			</div>
		</div>
	</div>
</div><br><br><br><br><br>
    <!--
<script>
    $(document).ready(function() {
	    $("#getwebdna").click(function() {
            $.ajax({
                type: "GET",
                cache: false,
                url: $('#url').val(),
                dataType:'JSONP',
                processData: false,
                complete: function (data) {
                    if (data.status==200) {
                        $('#getwebdna').attr("disabled", true);
                        $('#inputform').submit();
                    } else {
                        alert("链接无效,请检测你的url是否正确")
                    }
                }
            });
        });
    });
</script>
-->
<script type="text/javascript">
var add_res="";
var query="/api/whatcms"
var temp="没有poc到合适cms样本"
function requestss(url){
    $("#t_body").html(JSON.stringify([{"url":url}]))
    $("#result").html("运行脚本时间较长，等一下:");
    $.post(query,JSON.stringify([{"url":url}]),function (results){
        $("#result").html("获取中:");
        if(results){
            add_res="<tr><td>"+JSON.stringify(results)+"</td></tr>";
            $("#t_body").html(add_res);
        }else{
            add_res+="<tr><td>"+temp+"</td></tr>";
            $("#t_body").html(add_res);
        }
    },"json");
}

$(function() {
    $("#getwebdna").click(function() {
        add_res="";
        $("#t_body").html("")
        var url=$("#url").val();
        if(urlcheck()){
            requestss(url);
        }
    });
});

    </script>
{% endblock %}
